#include<bits/stdc++.h>
#define ll long long
#define L x<<1
#define R x<<1|1
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define Root 1,1,n
#define OK l>=Ll&&r<=Rr
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define pb push_back
#define ull unsigned ll
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned int 
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57) s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
const int N =1e6+5,M=4e6+5,inf=2147000000;
const ll llf=1e18,mod=998244353;
using namespace std;
int n,k,a[N];
ll mul[N<<1],inv[N<<1];
inline ll qp(ll a,ll b){
	if(!b)return 1;
	ll c=qp(a,b>>1);
	c=c*c%mod;
	if(b&1)c=c*a%mod;
	return c;
}
inline void prep(){
	mul[0]=inv[0]=1;
	rep(i,1,n+k)mul[i]=mul[i-1]*i%mod;
	inv[n+k]=qp(mul[n+k],mod-2);
	per(i,n+k-1,1)inv[i]=inv[i+1]*(i+1)%mod;
}
inline ll c(int x,int y){
	if(y>x)return 0;
	return mul[x]*inv[y]%mod*inv[x-y]%mod;
}
int main(){
	freopen("count.in","r",stdin);
	freopen("count.out","w",stdout);
	n=read(),k=read();
	prep();
	rep(i,1,n)a[i]=read();
	ll ans=mod-1;
	rep(i,1,n){
		if(i>1&&a[i]<a[i-1])break;
		rep(j,a[i-1],a[i]-1)(ans+=c(n-i+k-j-1,k-j-1))%=mod;
		if(i==n)(ans+=1)%=mod;
	}cout <<ans;
	return 0;
}
